public class Demo7 {
    public static void main(String[] args) {
        Thread t = new Thread(()->{
           System.out.println("线程开始!");
           try {
               Thread.sleep(2000);
           } catch (InterruptedException e) {
               throw new RuntimeException(e);
           }
           System.out.println("线程结束!");
        });

        // 线程未创建
        System.out.println(t.isAlive());// false
        t.start();
        // 线程已创建
        System.out.println(t.isAlive());// true
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        // 线程在2s后就销毁了,所以是false
        System.out.println(t.isAlive());// false
    }
}
